﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FATCASchema.Nodes
{
    public class PoolReportNode : iNode
    {
        public string Name { get; private set; }
        public bool AllowAddChildren { get; private set; }
        public List<iNode> Children { get; private set; }
        public object NodeObject { get; private set; }

        public PoolReportNode(CorrectablePoolReport_Type nodeObject)
        {
            this.Name = GetName(nodeObject);
            this.NodeObject = nodeObject;
            this.AllowAddChildren = false;
            this.LoadChildren();
        }

        private string GetName(CorrectablePoolReport_Type nodeObject)
        {
            string name = "Pool Report";

            if (nodeObject == null)
                return name;

            return name + " - " + FATCA_OECD.GetFriendlyEnumName(nodeObject.AccountPoolReportType);
        }

        public void LoadChildren()
        {
            if (this.NodeObject == null)
                return;

            //var nodeObject = (Fatca_TypeReportingGroup)this.NodeObject;
            //this.Children = new List<iNode>();
            
            //if (nodeObject.Sponsor != null)
            //    this.Children.Add(new CorrectableOrganisationParty("Sponsor", nodeObject.Sponsor));

            //if (nodeObject.Intermediary != null)
            //    this.Children.Add(new CorrectableOrganisationParty("Intermediary", nodeObject.Intermediary));

            //foreach (var item in nodeObject.ReportingGroup)
            //{
            //    this.Children.Add(new ReportingGroupNode(item));
            //}
        }

        public void AddChild()
        { }

        public void LoadPane()
        { }
    }
}
